package com.zmzncs.lmtc.module.promotion.pojo.month_rule_fee_scale;

import com.zmzncs.lmtc.common.pojo.enums.optionalvalue.promotion.MonthRentTypeEnum;
import com.zmzncs.lmtc.common.util.ExceptionUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;

/**
 * <p>
 * 促销-时长规则类型
 * </p>
 *
 * @author 任建波
 * @since 2020-08-12
 */
@Data
public class MonthRuleFeeScaleForm implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "金额", required = true)
    @NotNull
    private BigDecimal amount;

    @ApiModelProperty(value = "月租类型（MONTH：月付，QUARTER：季付，YEAR：年付）", required = true)
    private MonthRentTypeEnum monthRentType;

    /**
     * 表单验证
     */
    public void validate(){
        //  校验amount
        if(amount.compareTo(BigDecimal.ZERO) <= 0){
            ExceptionUtil.paramException("amount必须大于0");
        }
    }

}
